import { post, get } from '@/utils/axios'

const prefixUrl = '/sys/role/'

/** 保存权限 */
export const saveRole = (form) => {
  return post(`${prefixUrl}saveRole`, form)
}

/** 查询用户权限信息 */
export const findByUserId = (userId) => {
  return get(`${prefixUrl}findByUserId`, { userId })
}

/** 查询角色下拉框 */
export const getRoleOption = () => {
  return get(`${prefixUrl}getRoleOption`)
}

export const saveRoleMenu = (roleId, menus) => {
  return post('/sys/roleMenu/saveRole', { roleId, menus }, false)
}

export const getMenusByRole = (roleId) => {
  return get('/sys/roleMenu/getMenusByRole', { roleId })
}
